#ifndef COMMONTYPE
#define COMMONTYPE

#define DpR                         57.2957795130823//57.295780490443
#define RpD                         1.74532925199433e-2//1.74532922e-2
#define PI							3.141592653589793

//常用数据类型
typedef unsigned char	u8;		/* Unsigned  8 bit quantity                           */
typedef signed   char	i8;		/* Signed    8 bit quantity                           */
typedef unsigned short	u16;	/* Unsigned 16 bit quantity                           */
typedef signed   short	i16;	/* Signed   16 bit quantity                           */
typedef unsigned int	u32;	/* Unsigned 32 bit quantity                           */
typedef signed   int	i32;	/* Signed   32 bit quantity                           */
typedef float			f32;	/* float precision floating point                    */
typedef double			f64;	/* Double precision floating point                    */

//double类型3维矩阵数据结构
typedef union
{
	double  m[3][3];

	struct 
	{
		double	m11, m12, m13, m21, m22, m23, m31, m32, m33;
	}element; 

}dMatrix3_Struct;

//float类型3维矩阵数据结构
typedef union
{
	float  m[3][3];

	struct 
	{
		float	m11, m12, m13, m21, m22, m23, m31, m32, m33;
	}element; 

}fMatrix3_Struct;


//double类型3维矢量数据结构
typedef struct
{
	double	x, y, z;
}dVector3_Struct;

//float类型3维矢量数据结构
typedef struct
{
	float	x, y, z;
}fVector3_Struct;

//double类型2维矩阵数据结构
typedef struct
{
	double	m11, m12, m21, m22;
}dMatrix2_Struct;

//double类型2维矢量数据结构
typedef struct
{
	double	m1, m2;
}dVector2_Struct;


//四元素数据结构
typedef struct
{
	double	q0, q1,q2,q3;
}Q_Struct;

//惯组脉冲数结构体
typedef struct{
	dVector3_Struct pa, pg;
}Imu_Pag_Struct;

//惯组视速度增量、角增量结构体
typedef struct{
	dVector3_Struct a, g;
}Imu_ag_Struct;

//32位浮点数拟合结果
typedef struct
{
	float	avg_t;
	float	a1, b1;
	float	a2, b2;
	float	a3, b3;
}fMin2MulD;

//64位浮点数拟合结果
typedef struct
{
	double	avg_t;
	double	a1, b1;
	double	a2, b2;
	double	a3, b3;
}dMin2MulD;

//------[ 欧拉角结构体定义 3/4/2021 zhangqian]-------------------
typedef struct  
{
	f64 phi, psi, gma;
}Euler_struct;

typedef struct
{
	f64 phi, psi;
}FP_struct;

typedef struct
{
	f64 t;
	dVector3_Struct P, V, G;
}nav_res_struct;//导航结果结构体

typedef struct  
{
	f64 CB, SB, CA, SA, CL, SL;
}SinCos_struct;//正余弦结构体



//int类型三维矢量定义
typedef struct
{
	i8 x,y,z;
}iVector3_struct;


//float类型4维矩阵数据结构
typedef union
{
	f32 m[4][4];
	struct
	{
		f32 m11, m12, m13, m14;
		f32 m21, m22, m23, m24;
		f32 m31, m32, m33, m34;
		f32 m41, m42, m43, m44;
	}e;
}fMatrix4_Struct;

typedef union
{
	f64 m[4][4];
	struct
	{
		f64 m11, m12, m13, m14;
		f64 m21, m22, m23, m24;
		f64 m31, m32, m33, m34;
		f64 m41, m42, m43, m44;
	}e;
}dMatrix4_Struct;

//float类型4维矢量数据结构体
typedef union
{
	f32 m[4];
	struct
	{
		f32 m1, m2, m3, m4;
	}e;
	struct
	{
		f32 R, V, S, I;//R, V, S, I;//地心矢经、绝对速度、弹道倾角、轨道倾角
	}j;
	struct
	{
		f32 phi, psi, t, dphi;//Phi俯仰角, Psi偏航角, t开机剩余时间, dPhi俯仰角变化率
	}k;
}fVector4_Struct;


typedef union
{
	f64 m[4];
	struct
	{
		f64 m1, m2, m3, m4;
	}e;
	struct
	{
		f64 R, V, S, I;//R, V, S, I;//地心矢经、绝对速度、弹道倾角、轨道倾角
	}j;
	struct
	{
		f64 phi, psi, t, dphi;//Phi俯仰角, Psi偏航角, t开机剩余时间, dPhi俯仰角变化率
	}k;
}dVector4_Struct;

//------[ 二阶滤波器参数结构体 2/4/2021 zhangqian]-------------------
typedef struct
{
	f64 E0, E1, E2;
	f64 F1, F2;
}filter2_para_struct;

//------[ 三阶滤波器参数结构体 2/4/2021 zhangqian]-------------------
typedef struct
{
	f64 E0, E1, E2, E3;
	f64 F1, F2, F3;
}filter3_para_struct;

#endif
